
#ifndef quantlib_math_randomnumbers_gpurandomnumbers_gpumersennetwister_hpp
#define quantlib_math_randomnumbers_gpurandomnumbers_gpumersennetwister_hpp


#include <qt/math/randomnumbers/gpurandomnumbers.hpp>

namespace QuantLib 
{
	// Class for MT - uses CURAND library
	class GPUMersenneTwisterCreatedOnDevice : public GPURandomNumbersCreatedOnDevice {
		public:

			GPUMersenneTwisterCreatedOnDevice(int seed = 42) : GPURandomNumbersCreatedOnDevice(seed) {
				curandCreateGenerator(&_gen, CURAND_RNG_PSEUDO_MTGP32);
				resetGenerator();
			}

			void resetGenerator() {
				curandSetPseudoRandomGeneratorSeed(_gen, _seed);
			}

			void generateSample(int sampleSize) {	
				float mean = 0; 
				float sd = 1;
				_sampleSize = sampleSize;
				assignMemory();
				curandGenerateNormal(_gen, deviceData, _sampleSize, mean, sd);
			}

			~GPUMersenneTwisterCreatedOnDevice() {
				curandDestroyGenerator(_gen);
			}

	};
}

#endif